//
//  FMUserLoginedView.m
//  PsychologyFM
//
//  Created by lanou on 16/1/21.
//  Copyright © 2016年 ZhangLuDu. All rights reserved.
//

#import "FMUserLoginedView.h"

@implementation FMUserLoginedView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self addSubViews];
        
    }
    return self;
}

- (void)addSubViews
{
    _loginedScrollview = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    _loginedScrollview.contentSize = CGSizeMake(kScreenWidth, kScreenHeight + 120);
    _loginedScrollview.showsHorizontalScrollIndicator = NO;
    _loginedScrollview.showsVerticalScrollIndicator = NO;
    _loginedScrollview.bounces = YES;
    _loginedScrollview.alwaysBounceVertical = YES;
    _loginedScrollview.alwaysBounceHorizontal = NO;
//    _loginedScrollview.backgroundColor = FMCyan;
    [self addSubview:_loginedScrollview];
    
    //  顶部背景图
    _topBGImgView = [[UIImageView alloc]initWithFrame:(CGRectMake(0, 0, kScreenWidth, kScreenHeight / 5))];
    _topBGImgView.image = [UIImage imageNamed:@"bg1"];
    [_loginedScrollview addSubview:_topBGImgView];
    
    //  头标Label
    _iconImgView = [[UIImageView alloc]initWithFrame:CGRectMake(10, _topBGImgView.bottom - 15, 70, 70)];
    _iconImgView.image = [UIImage imageNamed:@"fm50"];
    _iconImgView.layer.masksToBounds = YES;
    _iconImgView.layer.cornerRadius = 35;
    [_loginedScrollview addSubview:_iconImgView];
    
    //  nickLabel
    _nickNameIConLabel = [[UILabel alloc]initWithFrame:CGRectMake(_iconImgView.right + 5, _iconImgView.top + 22.5, 200, 30)];
    _nickNameIConLabel.text = @"ssssssssssss";
    _nickNameIConLabel.textAlignment = NSTextAlignmentLeft;
    [_loginedScrollview addSubview:_nickNameIConLabel];
    //  introduceLabel
    _introduceLabel = [[UILabel alloc]initWithFrame:CGRectMake(_nickNameIConLabel.left, _nickNameIConLabel.bottom + 5, kScreenWidth - 100, 20)];
    _introduceLabel.text = @"hashdjahfkashfjklashfkjahsfkalhkfashklfhsadas";
    [_loginedScrollview addSubview:_introduceLabel];
    
    //  我的关注(背景ImageView + 按钮(小iconImageView + Label))
    UIImageView *attentionImageView = [[UIImageView alloc]initWithFrame:CGRectMake(_iconImgView.left, _iconImgView.bottom + 15, kScreenWidth - 30, 60)];
    attentionImageView.image = [UIImage imageNamed:@"quitBackground"];
    attentionImageView.userInteractionEnabled = YES;
    [_loginedScrollview addSubview:attentionImageView];

    _attentionButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _attentionButton.frame = attentionImageView.bounds;
    UIImageView *attentionIconImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"guanzhuByMe"]];
    attentionIconImgView.frame = CGRectMake(10, 10, 35, 35);
    [_attentionButton addSubview:attentionIconImgView];

    UILabel *attentionLabel = [[UILabel alloc]initWithFrame:CGRectMake(attentionIconImgView.right + 10, attentionIconImgView.top + 7.5, 100, 20)];
    attentionLabel.textColor = FMBlack;
    attentionLabel.textAlignment = NSTextAlignmentLeft;
    attentionLabel.text = @"我的关注";
    [_attentionButton addSubview:attentionLabel];
    [attentionImageView addSubview:_attentionButton];
    
  //  我赞过的(背景ImageView + 按钮(小iconImageView + Label))
    UIImageView *zanImageView = [[UIImageView alloc]initWithFrame:CGRectMake(_iconImgView.left, attentionImageView.bottom, kScreenWidth - 30, 60)];
    zanImageView.image = [UIImage imageNamed:@"quitBackground"];
    zanImageView.userInteractionEnabled = YES;
    [_loginedScrollview addSubview:zanImageView];
    
    _zanButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _zanButton.frame = zanImageView.bounds;
    UIImageView *zanIconImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"likeByMe@2x"]];
    zanIconImgView.frame = CGRectMake(10, 10, 35, 35);
    [_zanButton addSubview:zanIconImgView];
    
    UILabel *zanLabel = [[UILabel alloc]initWithFrame:CGRectMake(zanIconImgView.right + 10, zanIconImgView.top + 7.5, 100, 20)];
    zanLabel.textColor = FMBlack;
    zanLabel.textAlignment = NSTextAlignmentLeft;
    zanLabel.text = @"我赞过的";
    [_zanButton addSubview:zanLabel];
    [zanImageView addSubview:_zanButton];
    
  //  我的下载(背景ImageView + 按钮(小iconImageView + Label))
    UIImageView *downloadImageView = [[UIImageView alloc]initWithFrame:CGRectMake(_iconImgView.left, zanImageView.bottom, kScreenWidth - 30, 60)];
    downloadImageView.image = [UIImage imageNamed:@"quitBackground"];
    downloadImageView.userInteractionEnabled = YES;
    [_loginedScrollview addSubview:downloadImageView];
    
    _downloadButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _downloadButton.frame = downloadImageView.bounds;
    UIImageView *downloadIconImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"_0005_download"]];
    downloadIconImgView.frame = CGRectMake(10, 10, 35, 35);
    [_downloadButton addSubview:downloadIconImgView];
    
    UILabel *downloadLabel = [[UILabel alloc]initWithFrame:CGRectMake(downloadIconImgView.right + 10, downloadIconImgView.top + 7.5, 100, 20)];
    downloadLabel.textColor = FMBlack;
    downloadLabel.textAlignment = NSTextAlignmentLeft;
    downloadLabel.text = @"我的下载";
    [_downloadButton addSubview:downloadLabel];
    [downloadImageView addSubview:_downloadButton];
    
  //  我的话题(背景ImageView + 按钮(小iconImageView + Label))
    UIImageView *topicImageView = [[UIImageView alloc]initWithFrame:CGRectMake(_iconImgView.left, downloadImageView.bottom, kScreenWidth - 30, 60)];
    topicImageView.image = [UIImage imageNamed:@"quitBackground"];
    topicImageView.userInteractionEnabled = YES;
    [_loginedScrollview addSubview:topicImageView];
    
    _topicButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _topicButton.frame = topicImageView.bounds;
    UIImageView *topicIconImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"huatiByMe@2x"]];
    topicIconImgView.frame = CGRectMake(10, 10, 35, 35);
    [_topicButton addSubview:topicIconImgView];
    
    UILabel *topicLabel = [[UILabel alloc]initWithFrame:CGRectMake(topicIconImgView.right + 10, topicIconImgView.top + 7.5, 100, 20)];
    topicLabel.textColor = FMBlack;
    topicLabel.textAlignment = NSTextAlignmentLeft;
    topicLabel.text = @"我的话题";
    [_topicButton addSubview:topicLabel];
    [topicImageView addSubview:_topicButton];

  //  通知(背景ImageView + 按钮(小iconImageView + Label))
    UIImageView *notificationImageView = [[UIImageView alloc]initWithFrame:CGRectMake(_iconImgView.left, topicImageView.bottom + 15, kScreenWidth - 30, 60)];
    notificationImageView.image = [UIImage imageNamed:@"quitBackground"];
    notificationImageView.userInteractionEnabled = YES;
    [_loginedScrollview addSubview:notificationImageView];
    
    _notificationButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _notificationButton.frame = notificationImageView.bounds;
    UIImageView *notificationIconImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"_0002_notice"]];
    notificationIconImgView.frame = CGRectMake(10, 10, 35, 35);
    [_notificationButton addSubview:notificationIconImgView];
    
    UILabel *notificationLabel = [[UILabel alloc]initWithFrame:CGRectMake(notificationIconImgView.right + 10, notificationIconImgView.top + 7.5, 100, 20)];
    notificationLabel.textColor = FMBlack;
    notificationLabel.textAlignment = NSTextAlignmentLeft;
    notificationLabel.text = @"通知";
    [_notificationButton addSubview:notificationLabel];
    [notificationImageView addSubview:_notificationButton];
    
  //  私信(背景ImageView + 按钮(小iconImageView + Label))
    UIImageView *personalMsgImageView = [[UIImageView alloc]initWithFrame:CGRectMake(_iconImgView.left, notificationImageView.bottom, kScreenWidth - 30, 60)];
    personalMsgImageView.image = [UIImage imageNamed:@"quitBackground"];
    personalMsgImageView.userInteractionEnabled = YES;
    [_loginedScrollview addSubview:personalMsgImageView];
    
    _personalMsgButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _personalMsgButton.frame = personalMsgImageView.bounds;
    UIImageView *personalMsgIconImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"_0003_Mail"]];
    personalMsgIconImgView.frame = CGRectMake(10, 10, 35, 35);
    [_personalMsgButton addSubview:personalMsgIconImgView];
    
    UILabel *personalMsgLabel = [[UILabel alloc]initWithFrame:CGRectMake(personalMsgIconImgView.right + 10, personalMsgIconImgView.top + 7.5, 100, 20)];
    personalMsgLabel.textColor = FMBlack;
    personalMsgLabel.textAlignment = NSTextAlignmentLeft;
    personalMsgLabel.text = @"私信";
    [_personalMsgButton addSubview:personalMsgLabel];
    [personalMsgImageView addSubview:_personalMsgButton];

  //  我的礼物(背景ImageView + 按钮(小iconImageView + Label))
    UIImageView *giftImageView = [[UIImageView alloc]initWithFrame:CGRectMake(_iconImgView.left, personalMsgImageView.bottom + 15, kScreenWidth - 30, 60)];
    giftImageView.image = [UIImage imageNamed:@"quitBackground"];
    giftImageView.userInteractionEnabled = YES;
    [_loginedScrollview addSubview:giftImageView];
    
    _giftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _giftButton.frame = giftImageView.bounds;
    UIImageView *giftIconImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"_0001_gift"]];
    giftIconImgView.frame = CGRectMake(10, 10, 35, 35);
    [_giftButton addSubview:giftIconImgView];
    
    UILabel *giftLabel = [[UILabel alloc]initWithFrame:CGRectMake(giftIconImgView.right + 10, giftIconImgView.top + 7.5, 100, 20)];
    giftLabel.textColor = FMBlack;
    giftLabel.textAlignment = NSTextAlignmentLeft;
    giftLabel.text = @"我的礼物";
    [_giftButton addSubview:giftLabel];
    [giftImageView addSubview:_giftButton];
    
  //  我的金币(背景ImageView + 按钮(小iconImageView + Label))
    UIImageView *coinImageView = [[UIImageView alloc]initWithFrame:CGRectMake(_iconImgView.left, giftImageView.bottom, kScreenWidth - 30, 60)];
    coinImageView.image = [UIImage imageNamed:@"quitBackground"];
    coinImageView.userInteractionEnabled = YES;
    [_loginedScrollview addSubview:coinImageView];
    
    UIImageView *coinIconImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"_0000_coin"]];
    coinIconImgView.frame = CGRectMake(10, 10, 35, 35);
    [coinImageView addSubview:coinIconImgView];
    
    UILabel *coinLabel = [[UILabel alloc]initWithFrame:CGRectMake(coinIconImgView.right + 10, coinIconImgView.top + 7.5, 100, 20)];
    coinLabel.textColor = FMBlack;
    coinLabel.textAlignment = NSTextAlignmentLeft;
    coinLabel.text = @"我的金币";
    [coinImageView addSubview:coinLabel];
    
    _coinSizeLabel = [[UILabel alloc]initWithFrame:CGRectMake(coinImageView.right - 100, coinLabel.top, 80, coinLabel.height)];
    _coinSizeLabel.textAlignment = NSTextAlignmentRight;
    _coinSizeLabel.textColor = FMOrange;
    [coinImageView addSubview:_coinSizeLabel];
}

@end



